package com.ruleengine.destination.helper;

import org.pf4j.PluginClassLoader;
import org.pf4j.PluginDescriptor;
import org.pf4j.PluginManager;

public class RuleEngineClassLoader extends PluginClassLoader  {
    public RuleEngineClassLoader(PluginManager pluginManager,
                                 PluginDescriptor pluginDescriptor,
                                 ClassLoader parent) {
        super(pluginManager, pluginDescriptor, parent);
    }

    @Override
    public Class<?> loadClass(String className) throws ClassNotFoundException {
        synchronized (getClassLoadingLock(className)) {
            if (ProvidedPackages.isProvided(className)) {
                return getParent().loadClass(className);
            }
        }
        return super.loadClass(className);
    }
}
